package com.sooncode.project.focusservice.service;

import com.sooncode.project.core.finder.Finder;
import com.sooncode.project.core.finder.Sort;
import com.sooncode.project.focusservice.model.TestItem;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class TestItemService {
    public boolean add(Map map){
        TestItem testItem=new TestItem();
        testItem.add(map);
        return true;
    }
    public boolean modify(String id,Map map){
        TestItem testItem=getById(id);
        testItem.modify(map);
        return true;
    }
    public boolean delete(String id){
        TestItem testItem=getById(id);
        testItem.delete();
        return true;
    }
    public List<TestItem> getList(Map map){
        return new Finder<>(TestItem.class).byMap(map).list(Sort.ASC("code"));
    }
    public TestItem getById(String id){
        return new Finder<>(TestItem.class).byId(id);
    }
}
